<?php
require_once "../Common/database.php";
require_once "../Common/values.php";

$result1="SELECT * FROM tblJobs WHERE LogNumber LIKE '%$datelog%' ORDER BY LogNumber DESC";
$result = mysql_query($result1);
$logid = 1;

$dateloglimit = $datelog+1 ;
$dateloglimit=$dateloglimit.'0';

$row = mysql_fetch_array($result);




if ($date==$row['Date'])
{


$Log=$row['LogNumber']+1;
if ($Log==$dateloglimit)
{
$Log=$datelog.'10';
}

}
else
{
$Log=$datelog.$logid ;

}


if($_POST['Rev8']!='')
{
    $order=$order.'Rev8 Copy from : '.$_POST['Rev8Copy'].'
Kerridge mail groups : '.$_POST[KerridgeMailGroups].'
Point of Sale : '.$_POST[POSOperator1].' '.$_POST[POSOperator8].'
';
}
if($_POST['OutlookMail']!='')
{
    $order=$order.'Outlook Mail : '.$_POST['OutlookMail'].'
';
}
if($_POST['MobilePhone']!='')
{
    $order=$order.'Mobile Phone : '.$_POST['MobilePhone'].'
';
}
if($_POST['Firewall']!='')
{
    $order=$order.'Firewall password : '.$_POST['Firewall'].'
';
}
if($_POST['MazdaEcho']!='')
{
    $order=$order.'Mazda Echo : '.$_POST['MazdaEcho'].'
';
}


//CDS
$order=$order.'CDS Applactions
';
if($_POST['AFRL']!='')
{
    $order=$order.'AFRL
';
}
if($_POST['ATS']!='')
{
    $order=$order.'ATS
';
}
if($_POST['Cupid']!='')
{
    $order=$order.'Cupid
';
}
if($_POST['SalesP@prtner']!='')
{
    $order=$order.'SalesP@prtner
';
}
if($_POST['DBP']!='')
{
    $order=$order.'DBP
';
}
if($_POST['DSAT']!='')
{
    $order=$order.'DSAT
';
}
if($_POST['ECTS']!='')
{
    $order=$order.'ECTS
';
}
if($_POST['ESB']!='')
{
    $order=$order.'ESB
';
}
if($_POST['E-Tis']!='')
{
    $order=$order.'E-Tis
';
}
if($_POST['EUSED']!='')
{
    $order=$order.'EUSED
';
}
if($_POST['focalpt']!='')
{
    $order=$order.'focalpt
';
}
if($_POST['FPM']!='')
{
    $order=$order.'FPM
';
}
if($_POST['GCR']!='')
{
    $order=$order.'GCR
';
}
if($_POST['MIT']!='')
{
    $order=$order.'MIT
';
}
if($_POST['MPS']!='')
{
    $order=$order.'MPS
';
}
if($_POST['Rapid']!='')
{
    $order=$order.'Rapid
';
}
if($_POST['UsedWarranty']!='')
{
    $order=$order.'UsedWarranty
';
}
if($_POST['REACT']!='')
{
    $order=$order.'REACT
';
}
if($_POST['Reprints']!='')
{
    $order=$order.'Reprints
';
}
if($_POST['StockExchange']!='')
{
    $order=$order.'StockExchange
';
}
if($_POST['Vista']!='')
{
    $order=$order.'Vista
';
}
if($_POST['GWMS']!='')
{
    $order=$order.'GWMS
';
}
if($_POST['includeExtention']!='')
{
    $order=$order.'Include Extention : '.$_POST['includeExtention'].'
Phone Number : '.$_POST['ext'].'
';
}
if($_POST['Other']!='')
{
    $order=$order.'Other info : '.$_POST['Other'].'
';
}
$_POST[problem]=''.$order;
$_POST[requested]=$_POST['Requestedby'];

$result=mysql_query("SELECT * FROM tblstatus WHERE Name='$_POST[status]'");
$row = mysql_fetch_array($result);

$query="INSERT INTO tblJobs  (LogNumber,Operator,Requestor,Subject,Time,Date,Proirty,Line,Status,Problem,Branch,Department,Phone,VNC,Due,Assigned,Closed,Private,Project,Screenshot,mail) VALUES ('$Log','Public','$_POST[Joiner]','New user request','$time','$date','low','1','Pending','$_POST[problem]','$_POST[Site]','$_POST[Department]','$_POST[phone]','','$_POST[StartDate]','Not Assigned','','','helpdesk','')";

mysql_query($query);
$_POST[mail]='new';
$_POST[subject]='New user request';
$_POST[requestor]=$_POST[Joiner];
require "../Common/mail.php";
mysql_close();
echo '<center><h2>Job Logged ';
echo '<p>Log number '; echo $Log;

echo '<p><a href="http://192.168.14.154/vis/ITDEPT/New User Request Form_vhs.htm">Back</a>';

?>